<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>首页</title>
        <style>
            #left {
                width: 30%;
                float: left;
                height: 500px;
            }

            #right {
                width: 70%;
                margin-left: 30%;
                height: 500px;
            }

            .tips {
                color: red;
            }

            td {
                padding: 5px;
            }

            #left, #right {
                padding: 20px;
            }

            a {
                text-decoration: none;
            }

            a:visited {
                color: #222;
            }
        </style>
    </head>
    <body>

        <!--        <div style="margin: 50px auto; width: 1000px; text-align: center;">-->
        <!--            <form action="/file/upload" enctype="multipart/form-data" method="post">-->
        <!--                <input type="file" name="file">-->
        <!--                <input type="submit" value="上传">-->
        <!--            </form>-->
        <!--        </div>-->

        <!--        <table width="1000" style="margin: 50px auto;" border="1px solid #222">-->
        <!--            <tr>-->
        <!--                <td>文件ID</td>-->
        <!--                <td>文件名</td>-->
        <!--                <td>文件大小</td>-->
        <!--                <td>文件类型</td>-->
        <!--                <td>创建时间</td>-->
        <!--                <td>操作</td>-->
        <!--            </tr>-->
        <!--            <tr th:each="file : ${fileDTOList}">-->
        <!--                <td th:text="${file.id}"></td>-->
        <!--                <td th:text="${file.name}"></td>-->
        <!--                <td th:text="${file.size}"></td>-->
        <!--                <td th:text="${file.type}"></td>-->
        <!--                <td th:text="${#dates.format(file.time,'yyyy-MM-dd HH:mm:ss')}"></td>-->
        <!--                <td>-->
        <!--                    <a target="_blank" th:href="'/file/download?id='+${file.id}">下载</a>-->
        <!--                </td>-->
        <!--            </tr>-->
        <!--        </table>-->

        <div id="left">
            <h1>上传文档</h1>
            <form action="/doUpload" enctype="multipart/form-data" method="post">
                <table>

                    <tr>
                        <td>文档标题</td>
                        <td><input type="text" name="documentTitle"></td>
                    </tr>
                    <tr>
                        <td>文档关键字</td>
                        <td><input name="documentKeys" type="text"></td>
                    </tr>
                    <tr>
                        <td>选择文件</td>
                        <td><input name="file" type="file"></td>
                    </tr>
                    <tr>
                        <td>操作</td>
                        <td>
                            <input type="submit" value="提交">
                            <input type="reset" value="重置">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="tips">[[${msg}]]</td>
                    </tr>
                </table>
            </form>
        </div>
        <div id="right">
            <h1>文档检索</h1>

            <table>
                <form action="/" method="get">
                    <tr>
                        <td><input type="text" name="documentKey" placeholder="请输入文档号"></td>
                        <td><input type="submit" value="搜索"></td>
                    </tr>
                </form>
            </table>
            <table border="1" cellspacing="0" cellpadding="0" th:if="${documentDTOList != null && documentDTOList.size() > 0}">
                <tr>
                    <th>序号</th>
                    <th>标题</th>
                    <th>操作</th>
                </tr>
                <tr th:each="document,state : ${documentDTOList}">
                    <td>[[${state.index+1}]]</td>
                    <td>[[${document.documentTitle}]]</td>
                    <td>
                        <a th:href="${'/doDelete?id='+document.id}">删除</a>
                        <a th:href="${'/doDownload?fileId='+document.fileId}" target="_blank">下载</a>
                    </td>
                </tr>
            </table>
        </div>


    </body>
</html>